﻿using Sunny.UI;
using System.Threading;

namespace CoreShop.App
{
    public partial class FOrders : UIForm
    {
        public FOrders()
        {
            InitializeComponent();
        }

        private void uiButton1_Click(object sender, System.EventArgs e)
        {
            uiButton1.Selected = false;
            uiButton2.Selected = false;
            UIButton btn = (UIButton)sender;
            btn.Selected = true;
        }

        private void uiFlowLayoutPanel2_Click(object sender, System.EventArgs e)
        {

        }

        private void FOrders_Shown(object sender, System.EventArgs e)
        {
            timer1.Start();
        }

        private void timer1_Tick(object sender, System.EventArgs e)
        {
            timer1.Stop();
            ShowStatusForm(23);
            Thread.Sleep(100);

            uiFlowLayoutPanel2.Clear();
            OrderItemInfo info1 = new OrderItemInfo();
            info1.Name = "0001";
            info1.AddTag("店");
            info1.AddTag("反");
            info1.Returning = "部分退";
            info1.Order = "09/14 10:44 已结账";
            info1.OrderID = "订单尾号:140002";
            info1.Money = "￥18042";
            info1.MoneyFrom = "现金-人民币";
            UIOrderItem orderItem = new UIOrderItem(info1);
            uiFlowLayoutPanel2.Add(orderItem);
            StatusFormStepIt();

            orderItem = new UIOrderItem();
            info1 = new OrderItemInfo();
            info1.Name = "001";
            info1.AddTag("店");
            info1.Order = "09/14 10:39 已结账";
            info1.OrderID = "订单尾号:140001";
            info1.Money = "￥18042";
            info1.MoneyFrom = "自定义记账-收钱吧(营业中)";
            orderItem = new UIOrderItem(info1);
            uiFlowLayoutPanel2.Add(orderItem);
            StatusFormStepIt();

            //加载菜单数据
            uiFlowLayoutPanel1.Clear();

            MenuItemInfo info = new MenuItemInfo();
            info.Name = "花蟹";
            info.Count = "100";
            info.Money = "13800";
            info.IsReturning = true;
            info.Tags.Add("退菜原因：错点");
            UIMenuItem menu = new UIMenuItem(info);
            menu.SetMinSize();
            uiFlowLayoutPanel1.Add(menu);
            StatusFormStepIt();

            for (int i = 0; i < 20; i++)
            {
                info = new MenuItemInfo();
                info.Name = "金沙蒜香牛肉";
                info.Count = "1";
                info.Money = "42";
                menu = new UIMenuItem(info);
                menu.SetMinSize();
                uiFlowLayoutPanel1.Add(menu);

                info = new MenuItemInfo();
                info.Name = "桂花马蹄爽";
                info.Count = "100";
                info.Money = "18000";
                menu = new UIMenuItem(info);
                menu.SetMinSize();
                uiFlowLayoutPanel1.Add(menu);
                StatusFormStepIt();
            }

            HideStatusForm();
        }

        private void btnHomePage_Click(object sender, System.EventArgs e)
        {
            this.Close();
        }
    }
}
